package com.ship.control.search;

import org.apache.commons.lang.StringUtils;

/**
 * 物料查询
 * @author wqf
 * @version  Nov 24, 2011 11:55:45 AM
 */
public class ShipMaterialSearchCond extends SearchCond{
	
	/**
	 * 材料编码
	 */
	protected String code;	
	
	/**
	 * 材料名称
	 */
	protected String name;	
	
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public ConditionPart getCondition(){
		ConditionPart cp=new ConditionPart();
		StringBuffer searchStr=new StringBuffer(" 1=1");
				
		if(StringUtils.isNotBlank(code)){
			searchStr.append(" and code like ?");
			cp.getParams().add("%"+code+"%");
		}
		if(StringUtils.isNotBlank(name)){
			searchStr.append(" and name like ?");
			cp.getParams().add("%"+name+"%");
		}
		cp.setExpression(searchStr.toString());
		return cp;
	}


}
